package com.ysdwl.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysdwl.model.Provider;
import com.ysdwl.service.impl.ProviderService;

@WebServlet(urlPatterns = "/findProvider")
public class findProviderServlet extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		try {
			
		
		String name = req.getParameter("proName");
		
		
		Provider provider = new Provider();
		provider.setProName(name);
		ProviderService providerService = new ProviderService();
		List<Provider> list= providerService.findAll(provider);
		
		req.setAttribute("list", list);
		req.getRequestDispatcher("providerList.jsp").forward(req, resp);
		
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doGet(req, resp);
	}

}
